﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Meqs.Entity
{
    /// <summary>
    /// 题目类型
    /// </summary>
    [Serializable]
    public class QuestionTypes
    {
        private int _rID;
        private int _templateID;
        private string _qtName;
        private int _qtPosition;

        public QuestionTypes()
        {
        }

        public QuestionTypes(int rID, int templateID, string qtName, int qtPosition)
        {
            _rID = rID;
            _templateID = templateID;
            _qtName = qtName;
            _qtPosition = qtPosition;
        }

        /// <summary>
        /// ID
        /// </summary>
        public int RID
        {
            get { return _rID; }
            set { _rID = value; }
        }

        /// <summary>
        /// 样表ID
        /// </summary>
        public int TemplateID
        {
            get { return _templateID; }
            set { _templateID = value; }
        }

        /// <summary>
        /// 题类名称
        /// </summary>
        public string QtName
        {
            get { return _qtName; }
            set { _qtName = value; }
        }

        /// <summary>
        /// 排序
        /// </summary>
        public int QtPosition
        {
            get { return _qtPosition; }
            set { _qtPosition = value; }
        }

        public bool Equals(QuestionTypes other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return other._rID == _rID;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (QuestionTypes)) return false;
            return Equals((QuestionTypes) obj);
        }

        public override int GetHashCode()
        {
            return _rID;
        }
    }

    [Serializable]
    public class QuestionTypeExtends : QuestionTypes
    {
        private int _totalQuestions;
        private double _maxScore;

        public QuestionTypeExtends()
        {
        }

        public QuestionTypeExtends(int rID, int templateID, string qtName, int qtPosition, int totalQuestions, double maxScore)
            : base(rID, templateID, qtName, qtPosition)
        {
            _totalQuestions = totalQuestions;
            _maxScore = maxScore;
        }

        /// <summary>
        /// 题目数
        /// </summary>
        public int TotalQuestions
        {
            get { return _totalQuestions; }
            set { _totalQuestions = value; }
        }

        /// <summary>
        /// 总分
        /// </summary>
        public double MaxScore
        {
            get { return _maxScore; }
            set { _maxScore = value; }
        }
    }
}
